package com.zhongjian.technologycal.mall.activity.personal.activity;

import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.widget.TextView;

import com.zhongjian.technologycal.mall.R;
import com.zhongjian.technologycal.mall.base.BaseActivity;
import com.zhongjian.technologycal.mall.utils.StatusBarUtil;
import com.zhongjian.technologycal.mall.view.NumberRunningTextView;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by wei on 2017/12/25.
 * 分流额度的页面实现
 * coupon points vip   elec 红包 购物币  积分  现金币
 */

public class ShuntLimitActivity extends BaseActivity {
    @BindView(R.id.tv_main_title)
    TextView tv_main_title;
    @BindView(R.id.tv_total_count)
    NumberRunningTextView tv_total_count;
    private Dialog picChooseDialog = null;

    @Override
    protected void beforeInit() {
        super.beforeInit();
//        StatusBarUtil.setColorNoTranslucent(this, getResources().getColor(R.color.border_color));
//        StatusBarUtil.setMiuiStatusBarDarkMode(this, true);
    }

    @Override
    protected void initView(Bundle savedInstanceState) {
        tv_main_title.setText("分流额度");
        tv_total_count.setContent(getIntent().getStringExtra("typeMoney"));
    }

    @Override
    protected int getContentViewLayoutID() {
        return R.layout.activity_shunt_limit;
    }
    @OnClick(R.id.iv_back_page)
    public void onClickBack(){
        finish();
    }
    @Override
    public void initPresenter() {

    }
    @OnClick(R.id.split_ll_streem)
    public void onClickSplitStreem(){
        picChooseDialog = new Dialog(this, R.style.pic_choose_dialog_progress);
        View view = LayoutInflater.from(getBaseContext()).inflate(
                R.layout.split_choose_dialog, null);
        TextView choose_tv_photo1 = (TextView) view
                .findViewById(R.id.split_choose_tv_photo1);
        TextView choose_tv_photo2 = (TextView) view
                .findViewById(R.id.split_choose_tv_photo2);
        TextView choose_tv_cancel = (TextView) view
                .findViewById(R.id.split_choose_tv_cancel);

        choose_tv_photo1.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                picChooseDialog.dismiss();
                Intent intent = new Intent();
                intent.setClass(getBaseContext(),SplitStreamActivity.class);
                intent.putExtra("type",String.valueOf(1));
                startActivity(intent);


            }
        });
        choose_tv_photo2.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                picChooseDialog.dismiss();
                Intent intent = new Intent();
                intent.setClass(getBaseContext(),SplitStreamActivity.class);
                intent.putExtra("type",String.valueOf(2));
                startActivity(intent);

            }
        });

        // 取消
        choose_tv_cancel.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                picChooseDialog.dismiss();
            }
        });

        Window window = picChooseDialog.getWindow();
        window.setContentView(view);
        window.setGravity(Gravity.BOTTOM);
        window.setLayout(android.view.WindowManager.LayoutParams.MATCH_PARENT,
                android.view.WindowManager.LayoutParams.WRAP_CONTENT);
        window.setWindowAnimations(R.style.popupWindowAnimation);
        picChooseDialog.setCanceledOnTouchOutside(true);
        picChooseDialog.show();
    }

    /**
     * 分流额度
     */
    @OnClick(R.id.shunt_ll_record)
    public void onClickShuntRecord(){
        Intent intent = new Intent();
        intent.setClass(getBaseContext(),ShuntRecordActivity.class);
        startActivity(intent);
    }
}
